package com.aihuishou.monitor.model;

import lombok.Data;

@Data
public class DefaultEvent implements Event {

    public DefaultEvent() {
        this.timestamp = System.currentTimeMillis();
    }

    /**
     * 一级分类
     */
    private String type;

    /**
     * 二级分类
     */
    private String name;

    /**
     * 创建的时间戳，ms
     */
    private long timestamp;

    /**
     * 状态  0:成功  其他:失败
     */
    private String status;

    /**
     * 是否完成
     */
    private boolean completed;

    /**
     * 附加信息
     */
    private String attribute;

    public DefaultEvent copy() {
        DefaultEvent copyE = new DefaultEvent();
        copyE.setType(this.getType());
        copyE.setName(this.getName());
        copyE.setTimestamp(this.getTimestamp());
        copyE.setStatus(this.getStatus());
        copyE.setCompleted(this.isCompleted());
        copyE.setAttribute(this.getAttribute());
        return copyE;
    }

    @Override
    public void complete() {
        setCompleted(true);
    }
}
